const path = require("path");
const miniCssExtractPlugin=require('mini-css-extract-plugin')
module.exports = {
	entry: "./src/index.js",
	output: {
		clean: true,
		filename: "layui.js",
		path: path.resolve(__dirname, 'dist'),
		assetModuleFilename: "static/[hash][ext][query]",
		library: {
			type: "umd",
			name: 'layuiEsm',// 全局暴露对象
			export: 'default'
		}
	},
	module: {
		rules: [
			{
				test: /\.css$/,
				use: [
					miniCssExtractPlugin.loader,
					'css-loader'
				]
			}
		]
	},
	plugins: [
		new miniCssExtractPlugin({
			filename:'layui.css'
		})
	],
	mode: "production",
	devServer: {
		port: 3300,
		open: {
			app: {
				name: 'Google Chrome'
			}
		}
	}
}
